/** 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package it.free.i.virtual.machine.hal.devicealias.echo;

import it.free.i.virtual.machine.hal.devicealias.command.DeviceAliasPortCommand;
import it.free.i.virtual.machine.hal.devicealias.laboratory.positioningsystem.physics.CenterOfMassPosition;
import it.free.i.virtual.machine.hal.devicealias.laboratory.positioningsystem.physics.LinearVelocity;
import it.free.i.virtual.swarm.ComposableInformationUnit;
import it.free.i.virtual.swarm.ComposableInformationUnit.CIUGeneratorAllowedOperations;

/** 
 * Positioning data DTO impl
 * @author stefano
 */
public class PositionEchoImpl extends EchoImpl implements PositionEcho {

	private CenterOfMassPosition centerOfMassPosition = null;
	private LinearVelocity linearVelocity = null;
	private DeviceAliasPortCommand deviceAliasPortCommand = null;
	
	public PositionEchoImpl(){
		super();
	}

	/**
	 * @return the centerOfMassPosition
	 */
	public CenterOfMassPosition getCenterOfMassPosition() {
		return centerOfMassPosition;
	}

	/**
	 * @param centerOfMassPosition the centerOfMassPosition to set
	 */
	public void setCenterOfMassPosition(CenterOfMassPosition centerOfMassPosition) {
		this.centerOfMassPosition = centerOfMassPosition;
	}

	/**
	 * @return the linearVelocity
	 */
	public LinearVelocity getLinearVelocity() {
		return linearVelocity;
	}

	/**
	 * @param linearVelocity the linearVelocity to set
	 */
	public void setLinearVelocity(LinearVelocity linearVelocity) {
		this.linearVelocity = linearVelocity;
	}

	/**
	 * Set the command that caused this response to be generated
	 * @param deviceAliasPortCommand is the source do read command
	 */
	public void setInitiaLDeviceAliasPortCommand(DeviceAliasPortCommand deviceAliasPortCommand) {
		this.deviceAliasPortCommand = deviceAliasPortCommand;
	}

	/**
	 * Get the command that caused this response to be generated
	 * @return source command that caused the do read operation
	 */
	public DeviceAliasPortCommand getInitiaLDeviceAliasPortCommand() {
		return this.deviceAliasPortCommand;
	}

	public ComposableInformationUnit getRenderedObjectImage() {
		
		ComposableInformationUnit composableInformationUnit = ComposableInformationUnit.Factory.createObject();
		composableInformationUnit.setAttribute("linearVelocity.X", this.linearVelocity.getX());
		composableInformationUnit.setAttribute("linearVelocity.Y", this.linearVelocity.getY());
		composableInformationUnit.setAttribute("linearVelocity.Z", this.linearVelocity.getZ());
		composableInformationUnit.setAllowedOperations(CIUGeneratorAllowedOperations.READ);
		
		composableInformationUnit.setCiuType(this.getClass().getName());
		
		return composableInformationUnit;
	}
	
	
}
